﻿<Window x:Class="StockAnalyst2.Options.OptionsDialog"
		x:ClassModifier="internal"
		
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		mc:Ignorable="d"
		
		xmlns:Utils="clr-namespace:Utils.Wpf;assembly=Utils" 
		xmlns:Options="clr-namespace:StockAnalyst2.Options"
		
        Title="Options" 
        ResizeMode="NoResize" 
        SizeToContent="WidthAndHeight" 
		ShowInTaskbar="False" 
        WindowStartupLocation="CenterOwner" 
		Icon="/StockAnalyst2;component/Resources/Main.ico"
		
		Utils:WindowBehavior.HideCloseButton="True"
		
        d:DataContext="{d:DesignInstance Type=Options:OptionsVM}" >

	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../StockAnalystTheme.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</Window.Resources>

	<Window.Background>
		<StaticResource ResourceKey="WindowBackground" />
	</Window.Background>
	
	<StackPanel>
		<Border BorderBrush="White" BorderThickness="1" CornerRadius="5" Margin="3" >
			<Grid Margin="3" >
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="171" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
				</Grid.RowDefinitions>

				<TextBlock Grid.Row="1" Margin="3" VerticalAlignment="Center" Text="User" x:Name="UserLabel" />
				<TextBlock Grid.Row="2" Margin="3" VerticalAlignment="Center" Text="Password" />
				<TextBlock Grid.Row="3" Margin="3" VerticalAlignment="Center" Text="Database Server" />
				<TextBlock Grid.Row="4" Margin="3" VerticalAlignment="Center" Text="Database Name" />

				<CheckBox Grid.Row="0" Grid.Column="1" Margin="3"  VerticalAlignment="Center" Content="Enable Realtime" IsChecked="{Binding ApplicationOptionsVM.RealTimeEnabled, Mode=TwoWay}" >
					<CheckBox.ToolTip>
						<StackPanel>
							<TextBlock Foreground="Black" FontWeight="Bold" Text="Enable Or Disable Realtime Capture" />
							<TextBlock Foreground="Black" Text="Enables or disables the realtime capture of stock data. To enable it you need an account with Interdin and supply its username and password." />
						</StackPanel>
					</CheckBox.ToolTip>
				</CheckBox>
				<TextBox Grid.Row="1" Grid.Column="1" Margin="3" IsEnabled="{Binding ApplicationOptionsVM.RealTimeEnabled}"  Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, Path=ApplicationOptionsVM.UserName}" x:Name="UserTextBox" >
					<TextBox.ToolTip>
						<StackPanel>
							<TextBlock Foreground="Black" FontWeight="Bold" Text="Interdin Username" />
							<TextBlock Foreground="Black" Text="The username of the Interdin account." />
						</StackPanel>
					</TextBox.ToolTip>
				</TextBox>
				<PasswordBox Grid.Row="2" Grid.Column="1" Margin="3" IsEnabled="{Binding ApplicationOptionsVM.RealTimeEnabled}" x:Name="PasswordBox" Utils:PasswordBoxAssistant.BindPassword="True" Utils:PasswordBoxAssistant.BoundPassword="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, Path=ApplicationOptionsVM.Password}" >
					<PasswordBox.ToolTip>
						<StackPanel>
							<TextBlock Foreground="Black" FontWeight="Bold" Text="Interdin Password" />
							<TextBlock Foreground="Black" Text="The password of the Interdin account. It is stored encripted." />
						</StackPanel>
					</PasswordBox.ToolTip>
				</PasswordBox>
				<TextBox Grid.Row="3" Grid.Column="1" Margin="3" Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, Path=ApplicationOptionsVM.DatabaseServer}" >
					<TextBox.ToolTip>
						<StackPanel>
							<TextBlock Foreground="Black" FontWeight="Bold" Text="Database Server" />
							<TextBlock Foreground="Black" Text="The name of your SQL Server instace. This application cannot work without one." />
						</StackPanel>
					</TextBox.ToolTip>
				</TextBox>
				<TextBox Grid.Row="4" Grid.Column="1" Margin="3" Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, Path=ApplicationOptionsVM.DatabaseName}" >
					<TextBox.ToolTip>
						<StackPanel>
							<TextBlock Foreground="Black" FontWeight="Bold" Text="Database Name" />
							<TextBlock Foreground="Black" Text="The name of your database. This application cannot work without one." />
						</StackPanel>
					</TextBox.ToolTip>
				</TextBox>
			</Grid>
		</Border>
		
		<UniformGrid Columns="2" HorizontalAlignment="Right" Margin="3,0,6,0" >
			<Button Content="Accept" Margin="3" Padding="12,3,12,3" IsDefault="True" Command="{Binding AcceptCommand}" />
			<Button Content="Cancel" Margin="3" Padding="12,3,12,3" IsCancel="True" Command="{Binding CancelCommand}" />
		</UniformGrid>
	</StackPanel>
</Window>
